{extend name="/fool" /}
{block name="css"}
<link rel="stylesheet" href="/css/admin/product_list.css">
<style>
    .layui-form-onswitch{
        /*background: #1989FA;*/
        /*border-color: #1989FA;*/
    }
    #page{
        position: relative;
        display: inline-block;
        left:30%;
        margin-left:-50px;
        padding:50px 0;
    }
    tr{
        line-height:38px;
    }
</style>
{/block}
{block name="menu_content"}
<div id="one">
    <form class="layui-form" action="" method="post">
        <ul>
            <li>
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="">审核状态</option>
                        <option value="99">已审核</option>
                        <option value="20">未审核</option>
                    </select>
                </div>
                <button type="Submit" class="layui-btn">筛选</button>
            </li>
        </ul>
    </form>
</div>
<div>
    <form class="layui-form" action="" method="post">
        <table>
            <tr>
                <th>姓名</th>
                <th>电话</th>
                <th>地区</th>
                <th>身份证号</th>
                <th>审核状态</th>
                <th class="last">操作</th>
            </tr>
            {if isset($list)}
            {foreach $list as $v}
            <tr class="list">
                <td class="name">{$v.name}</td>
                <td class="phone">{$v.phone}</td>
                <td class="region">{$v.region}</td>
                <td class="number">{$v.number}</td>
                <td>
                    {if $v.status == 20}
                    未审核
                    {elseif $v.status == 77}
                    驳回
                    {elseif $v.status == 90}
                    封禁
                    {else}
                    已审核
                    {/if}
                </td>
                <td>
                    {if $v.status == 20}
                    <button sid="{$v.id}" type="button" class="viewbu layui-btn">处理</button>
                    {/if}
                </td>
            </tr>
            {/foreach}
            {/if}
        </table>
    </form>
    <div id="page">
        {if isset($list)}
        {$page|raw}
        {/if}
    </div>
</div>
<script>
    $(".viewbu").click(function(){
        var id = $(this).attr('sid');
        var name = $(this).closest('tr').find(".name").html();
        var phone = $(this).closest('tr').find(".phone").html();
        var region = $(this).closest('tr').find(".region").html();
        var number = $(this).closest('tr').find(".number").html();
        parent.$(window.parent.document).find("#hd").show();
        parent.$(window.parent.document).find("#groupadd").show();
        parent.$(window.parent.document).find("#table_two").show();
        parent.$(window.parent.document).find("#table_two_title").show();
        parent.$(window.parent.document).find("#table").val('aaa');
        parent.$(window.parent.document).find("#groupadd .class").val('2');
        parent.$(window.parent.document).find("#username").html(name);
        parent.$(window.parent.document).find("#userphone").html(phone);
        parent.$(window.parent.document).find("#usernumber").html(number);
        parent.$(window.parent.document).find("#useradd").html(region);
        parent.$(window.parent.document).find("#userid").val(id);
    })
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test1'
            ,type: 'month'
            ,range: '至'
            ,format: 'yyyy-MM'
        });
    });
    layui.use('laypage', function(){
        var laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'page'
            ,count: "{$count}"
            ,curr:"{$curl}"
            ,last:"{$groups}"
            ,limit:"{$limit}"
            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            ,jump: function(obj,first){
                console.log(obj)
                if(!first){
                    var url = "{:url('register',['id'=>5,'index'=>0])}" + '&page=' + obj.curr + '&limit=' + obj.limit + '&curr=' + obj.curr;
                    location.href = url;
                }
            }
        });
    });
</script>
{/block}